package edu.scnu.fans.fingertip.item.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import edu.scnu.fans.fingertip.item.output.ItemImgOutput;
import lombok.Data;

import java.time.Instant;

/**
 * 商品图片表
 */
@Data
@TableName("item_img")
public class ItemImg {

    @TableId(type = IdType.AUTO)
    private Long id;

    private Instant created;
    private Instant updated;
    private boolean deleted;

    /** 商品id */
    private Long itemId;
    /** 排序 */
    private Integer sort;
    /** 图片链接 */
    private String imgUrl;
    
    public ItemImgOutput transferToOutput() {
        return new ItemImgOutput(id, itemId, sort, imgUrl);
    }
}
